/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package org.vale.entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Gabriel Bran gbran.u@gmail.com
 */
@Entity
@Table(name = "answer_choise")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "AnswerChoise.findAll", query = "SELECT a FROM AnswerChoise a"),
    @NamedQuery(name = "AnswerChoise.findByIdChoise", query = "SELECT a FROM AnswerChoise a WHERE a.idChoise = :idChoise"),
    @NamedQuery(name = "AnswerChoise.findByChoise", query = "SELECT a FROM AnswerChoise a WHERE a.choise = :choise")})
public class AnswerChoise implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_choise")
    private Integer idChoise;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "choise")
    private String choise;
    @JoinColumn(name = "id_question", referencedColumnName = "id_question")
    @ManyToOne(optional = false)
    private FormQuestion idQuestion;

    public AnswerChoise() {
    }

    public AnswerChoise(Integer idChoise) {
        this.idChoise = idChoise;
    }

    public AnswerChoise(Integer idChoise, String choise) {
        this.idChoise = idChoise;
        this.choise = choise;
    }

    public Integer getIdChoise() {
        return idChoise;
    }

    public void setIdChoise(Integer idChoise) {
        this.idChoise = idChoise;
    }

    public String getChoise() {
        return choise;
    }

    public void setChoise(String choise) {
        this.choise = choise;
    }

    public FormQuestion getIdQuestion() {
        return idQuestion;
    }

    public void setIdQuestion(FormQuestion idQuestion) {
        this.idQuestion = idQuestion;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idChoise != null ? idChoise.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof AnswerChoise)) {
            return false;
        }
        AnswerChoise other = (AnswerChoise) object;
        if ((this.idChoise == null && other.idChoise != null) || (this.idChoise != null && !this.idChoise.equals(other.idChoise))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.vale.entity.AnswerChoise[ idChoise=" + idChoise + " ]";
    }
    
}
